
from .models import Poem

def getAllTitles():
    poem = Poem.objects.all()
    titles = [p.title for p in poem ]
    return titles 

def getPoemByTitle(timu):
    p = Poem.objects.filter(title=timu)[0]
    d = {'title':p.title,
         'content':[ i for i in  p.content.split(' ')]}
    return d

def addPoem(TIMU, NEIRONG):
    Poem.objects.create(title=TIMU, content=NEIRONG)